A public type describing a curve fitter y = c(x)
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | bc | = | OUTSIDE_NEAREST_BND | ||
| real(kind=RKIND), | public, | allocatable | :: | c(:) | |||
| real(kind=RKIND), | public | :: | fp | = | zero | ||
| integer, | public | :: | iopt | = | 0 | ||
| integer, | public, | allocatable | :: | iwrk(:) | |||
| integer, | public | :: | knots | = | 0 | ||
| integer, | public | :: | lwrk | = | 0 | ||
| integer, | public | :: | m | = | 0 |
The data points |
|
| integer, | public | :: | nest | = | 0 | ||
| integer, | public | :: | order | = | 3 |
Spline degree |
|
| real(kind=RKIND), | public | :: | smoothing | = | 1000.0_RKIND | ||
| real(kind=RKIND), | public, | allocatable | :: | sp(:) | |||
| real(kind=RKIND), | public, | allocatable | :: | t(:) | |||
| real(kind=RKIND), | public, | allocatable | :: | w(:) | |||
| real(kind=RKIND), | public, | allocatable | :: | wrk(:) | |||
| real(kind=RKIND), | public, | allocatable | :: | x(:) | |||
| real(kind=RKIND), | public | :: | xleft |
Interval boundaries |
|||
| real(kind=RKIND), | public | :: | xright |
Interval boundaries |
|||
| real(kind=RKIND), | public, | allocatable | :: | y(:) |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=RKIND), | intent(in) | :: | x(:) | |||
| real(kind=RKIND), | intent(in) | :: | y(size(x)) | |||
| real(kind=RKIND), | intent(in), | optional | :: | w(size(x)) | ||
| integer, | intent(out), | optional | :: | ierr |
Clean memory
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fitpack_curve), | intent(inout) | :: | this |
Evaluate k-th derivative of the curve at points x Use 1st derivative if order not present
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fitpack_curve), | intent(inout) | :: | this | |||
| real(kind=RKIND), | intent(in) | :: | x | |||
| integer, | intent(in), | optional | :: | order | ||
| integer, | intent(out), | optional | :: | ierr |
Evaluate k-th derivative of the curve at points x Use 1st derivative if order not present
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fitpack_curve), | intent(inout) | :: | this | |||
| real(kind=RKIND), | intent(in) | :: | x(:) | |||
| integer, | intent(in), | optional | :: | order | ||
| integer, | intent(out), | optional | :: | ierr |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fitpack_curve), | intent(inout) | :: | this | |||
| real(kind=RKIND), | intent(in) | :: | x | |||
| integer, | intent(out), | optional | :: | ierr |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fitpack_curve), | intent(inout) | :: | this | |||
| real(kind=RKIND), | intent(in) | :: | x(:) | |||
| integer, | intent(out), | optional | :: | ierr |
Generate/update fitting curve, with optional smoothing
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fitpack_curve), | intent(inout) | :: | this | |||
| real(kind=RKIND), | intent(in), | optional | :: | smoothing |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fitpack_curve), | intent(inout) | :: | this |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fitpack_curve), | intent(in) | :: | this |
Generate new fit
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fitpack_curve), | intent(inout) | :: | this | |||
| real(kind=RKIND), | intent(in) | :: | x(:) | |||
| real(kind=RKIND), | intent(in) | :: | y(size(x)) | |||
| real(kind=RKIND), | intent(in), | optional | :: | w(size(x)) | ||
| real(kind=RKIND), | intent(in), | optional | :: | smoothing |
Set new points
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fitpack_curve), | intent(inout) | :: | this | |||
| real(kind=RKIND), | intent(in) | :: | x(:) | |||
| real(kind=RKIND), | intent(in) | :: | y(size(x)) | |||
| real(kind=RKIND), | intent(in), | optional | :: | w(size(x)) |
type :: fitpack_curve !> The data points integer :: m = 0 real(RKIND), allocatable :: x(:),y(:) !> Spline degree integer :: order = 3 !> Interval boundaries real(RKIND) :: xleft,xright ! Node weights real(RKIND), allocatable :: sp(:),w(:) ! Estimated and actual number of knots and their allocations integer :: nest = 0 integer :: lwrk = 0 integer, allocatable :: iwrk(:) real(RKIND), allocatable :: wrk(:) ! Curve fit smoothing parameter (fit vs. points MSE) real(RKIND) :: smoothing = 1000.0_RKIND ! Actual curve MSE real(RKIND) :: fp = zero ! Curve extrapolation behavior integer :: bc = OUTSIDE_NEAREST_BND ! Knots integer :: knots = 0 real(RKIND), allocatable :: t(:) ! Knot location ! Spline coefficients [knots-order-1] real(RKIND), allocatable :: c(:) ! Runtime flag integer :: iopt = 0 contains !> Clean memory procedure :: destroy !> Set new points procedure :: new_points !> Generate new fit procedure :: new_fit !> Generate/update fitting curve, with optional smoothing procedure :: fit => curve_fit_automatic_knots procedure :: interpolate => interpolating_curve !> Evaluate curve at given coordinates procedure, private :: curve_eval_one procedure, private :: curve_eval_many generic :: eval => curve_eval_one,curve_eval_many !> Evaluate derivative at given coordinates procedure, private :: curve_derivative procedure, private :: curve_derivatives generic :: dfdx => curve_derivative,curve_derivatives !> Properties: MSE procedure, non_overridable :: mse => curve_error end type fitpack_curve